
import { _decorator,Node,Label } from "cc";
import BaseComponent from "../../../../framework/components/BaseComponent";
import ListViewItemBase from "../../../../framework/components/scroll_view/list_view/ListViewItemBase";
import { Loger } from "../../../../framework/loger/Loger";

const { ccclass, property, menu } = _decorator;
@ccclass("ListViewItem")
@menu("GameView/ListViewItem")
export default class ListViewItem extends ListViewItemBase{

    /**数据 */
    protected data: {txt:string};
    @property({type:Label})
    txt:Label = null;

    start(){
        this.setClickListener(this.node,this.onClick,this)
    }

    /**数据改变,子类重写 */
    protected dataChanged() {
        this.txt.string = this.data.txt;
    }

    onClick(){
        if (!this.data) {
            return;
        }
        Loger.log("点击列表:",this.data.txt);
    }
}